home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_pyr_tombcrumble.cog < prev    next >
Text File  |  1999-11-15  |  8KB  |  337 lines

  1. # Jones 3D Cog Script
  2. #
  3. # pyr_tombcrumble.cog
  4. #
  5. # Use Imp#1 to open the ceiling of the gold idol crypt
  6. #
  7. # [RKD]
  8. #
  9. # (C) 1999 LucasArts Entertainment Company LLC. All Rights Reserved
  10. # ==============================================================================
  11.  
  12. symbols
  13. message    startup
  14. message    damaged
  15. message    activated
  16. message    pulse
  17.  
  18. # world things
  19. thing      bombpos        nolink
  20. thing    goldidol    nolink
  21. thing    dustgen        nolink
  22. thing    player        local
  23. thing    dustthing    local    
  24.  
  25. # cameras and lookthings
  26. thing    rumblecam
  27. thing    rumblecamlook
  28. thing    cam1spot    local
  29. thing    cam1look    local
  30.  
  31. # surfaces
  32. surface    crackedwall        mask=0x408
  33. surface    crackedwall2    mask=0x408
  34. surface    ceiling            nolink
  35. surface    roof1            nolink
  36. surface    roof2            nolink
  37.  
  38. # sectors
  39. sector    noseesector        nolink
  40. sector    tombtop1        nolink
  41. sector    tombtop2        nolink
  42.  
  43. # templates
  44. template    debris=stoneshrapa    local
  45. template    dust=dustcloud4ever    local
  46.  
  47. # materials
  48. material    dustmat=gen_a4sfx_dustcloud.mat    local
  49.  
  50. # sounds and fury
  51. sound    crunch=pru_boulder_crash_c.wav        local
  52. sound    crash=sol_block_crash_c.wav            local
  53. sound    boom=olv_quetzdoor_stop_c.wav        local
  54. sound    rumble=imp1_wall_break.wav            local
  55. sound    explosion=shw_wall_crash.wav        local
  56. sound    imp1Charge=imp1_chargeup.wav        local
  57.  
  58. # indy saylines
  59. sound    crumble=inxj025.wav        local
  60. sound    vibrate=inxj026.wav        local
  61.  
  62. # variables
  63. int        i=0                local
  64. int        locked=0        local
  65. int        fragment=0        local
  66. int        counter=0        local
  67. int        quivercam=0        local
  68. flex    shakefactor=0    local
  69.  
  70. # subroutines
  71. flex    blowitup=0.0    local
  72. end
  73.  
  74. code
  75. startup:
  76.     Sleep(.01);
  77.     
  78.     # make various faces drawn and no-move
  79.     ClearAdjoinFlags(crackedwall, 2);
  80.     ClearAdjoinFlags(ceiling, 2);
  81.     ClearAdjoinFlags(roof1, 2);
  82.     ClearAdjoinFlags(roof2, 2);
  83.     SetFaceGeoMode(crackedwall, 4);
  84.     SetFaceGeoMode(ceiling, 4);
  85.     SetFaceGeoMode(roof1, 4);
  86.     SetFaceGeoMode(roof2, 4);
  87.     
  88.     SetSectorAdjoins(noseesector, 0);
  89.     SetSectorAdjoins(tombtop1, 0);
  90.     SetSectorAdjoins(tombtop2, 0);
  91.     return;
  92.  
  93. activated:
  94. # --- > cracked wall (and crackedwall2, which is a ceiling)
  95.  
  96.     if ((GetSenderRef() != crackedwall) && (GetSenderRef() != crackedwall2)) return;
  97.     if (locked) return;
  98.  
  99.     player = GetLocalPlayerThing();
  100.     
  101.     # if holding IMP1, make it a damage event
  102.     if ((GetCurWeapon(player) == 14) || (InEditor()))
  103.     {
  104.         call blowitup;
  105.         return;
  106.     }
  107.  
  108.     # if not holding IMP1, use saylines instead
  109.     if (MakeMeStop() == -1) return;
  110.     DeselectWeaponWait(player);
  111.  
  112.     StartCutscene(0);
  113.     
  114.     # setup offset camera
  115.     cam1spot = CreateThing(GetThingTemplate(rumblecam), rumblecam);
  116.     cam1look = CreateThing(GetThingTemplate(rumblecam), rumblecam);
  117.     MakeCamera2LikeCamera1(cam1spot, cam1look);
  118.     SetCameraLookInterp(2, 0);
  119.     SetCameraPosInterp(2, 0);
  120.     SetCameraFocus(2, cam1spot);
  121.     SetCameraSecondaryFocus(2, cam1look);
  122.     SetCurrentCamera(2);
  123.     ResetCameraFOV(0, 0.0);
  124.     SetCameraLookInterp(2, 1);
  125.     SetCameraPosInterp(2, 1);
  126.     SetCameraInterpSpeed(2, 0.7);
  127.     Sleep(0.01);
  128.     SetCameraFocus(2, rumblecam);
  129.     SetCameraSecondaryFocus(2, rumblecamlook);
  130.     
  131.     # say line shifts with every activation
  132.     Sleep(0.3);
  133.     if (i == 0)
  134.     {
  135.         PlayVoice(player, vibrate, 1.0, 1);
  136.     }
  137.     else
  138.     {
  139.         PlayVoice(player, crumble, 1.0, 1);
  140.     }
  141.  
  142.     i = 1 - i;
  143.  
  144.     # restore controls and camera
  145.     SetCameraLookInterp(2, 0);
  146.     SetCameraPosInterp(2, 0);
  147.     SetCameraPosition(1, GetThingPos(rumblecam));
  148.     SetCurrentCamera(1);
  149.     DestroyThing(cam1spot);
  150.     DestroyThing(cam1look);
  151.  
  152.     # finish up
  153.     EndCutscene();
  154.     ClearActorFlags(player, 0x200000);
  155.  
  156.     return;
  157.  
  158.  
  159. damaged:
  160. # --- > cracked wall (and crackedwall2, which is a ceiling)
  161.     
  162.     player = GetLocalPlayerThing();
  163.     
  164.     # quit out if damage isn't caused by IMP1
  165.     if (GetParam(1) != 0x1000) return;
  166.     if ((GetSenderRef() != crackedwall) && (GetSenderRef() != crackedwall2)) return;
  167.  
  168. blowitup:    
  169.     # if already blown, skip it
  170.     if (locked) return;
  171.     
  172.     # do cutscene stuff
  173.     if (MakeMeStop() == -1) return;
  174.  
  175.     StartCutscene(1);
  176.     locked = 1;
  177.     
  178.     # deal with adjoins
  179.     SetSectorAdjoins(noseesector, 1);
  180.     SetSectorAdjoins(tombtop1, 1);
  181.     SetSectorAdjoins(tombtop2, 1);
  182.  
  183.     # setup offset camera
  184.     cam1spot = CreateThing(GetThingTemplate(rumblecam), rumblecam);
  185.     cam1look = CreateThing(GetThingTemplate(rumblecam), rumblecam);
  186.     MakeCamera2LikeCamera1(cam1spot, cam1look);
  187.     SetCameraLookInterp(2, 0);
  188.     SetCameraPosInterp(2, 0);
  189.     SetCameraFocus(2, cam1spot);
  190.     SetCameraSecondaryFocus(2, cam1look);
  191.     SetCurrentCamera(2);
  192.     ResetCameraFOV(0, 0.0);
  193.     SetCameraLookInterp(2, 1);
  194.     SetCameraPosInterp(2, 1);
  195.     SetCameraInterpSpeed(2, 0.7);
  196.     Sleep(0.01);
  197.     SetCameraFocus(2, rumblecam);
  198.     SetCameraSecondaryFocus(2, rumblecamlook);
  199.  
  200.     # start camera quiver
  201.     quivercam = 1;
  202.     SetPulse(0.05);
  203.  
  204.     # alter fov for zoom-in effect
  205.     SetCameraFOV(70, 1, 2.5);
  206.  
  207.     # play chargeup effect and light up the player
  208.     PlaySoundThing(imp1charge, player, 1.0, 10.0, 20.0, 0);
  209.     SetThingLight(bombpos, '0.25 0.55 1.0', 5.0, 2.0);
  210.     Sleep(1.5);
  211.     
  212.     # play crackling effect
  213.     PlaySoundThing(rumble, bombpos, 1.0, 10.0, 20.0, 0);
  214.     Sleep(1);
  215.     
  216.     # reset fov
  217.     SetCameraFOV(90, 0, 0.0);
  218.  
  219.     # kill dynamic light
  220.     SetThingLight(bombpos, '0.0 0.0 0.0', 5.0, 2.0);
  221.  
  222.     shakefactor = 4;
  223.     quivercam = 0;
  224.     SetPulse(.1);
  225.  
  226.     PlaySoundLocal(explosion, 1, 0, 0x0, 0);
  227.     
  228.     # create debris
  229.     for(i=0; i<8; i=i+1)                                                            
  230.     {
  231.         fragment = CreateThing(debris, bombpos);
  232.         SetThingVel(fragment, VectorScale(VectorAdd(RandVec(), '-0.5 -0.1 0.0'), 1));
  233.         SetThingRotVel(fragment, VectorScale(VectorAdd(RandVec(), '0.0 0.0 0.0'), 200.0));
  234.         Sleep(0.025);
  235.     }
  236.     
  237.     # make various faces invisible and traversible
  238.     SetAdjoinFlags(crackedwall, 2);
  239.     SetAdjoinFlags(ceiling, 2);
  240.     SetAdjoinFlags(roof1, 2);
  241.     SetAdjoinFlags(roof2, 2);
  242.     SetFaceGeoMode(crackedwall, 0);
  243.     SetFaceGeoMode(ceiling, 0);
  244.     SetFaceGeoMode(roof1, 0);
  245.     SetFaceGeoMode(roof2, 0);
  246.         
  247.     # light up the idol
  248.     SetThingLight(goldidol, '.4 .4 1', .001, .01);
  249.     
  250.     # create and animate the dust sprites
  251.     SetMaterialCel(dustmat, 0);
  252.     MaterialAnim(dustmat, 1.0, 1);
  253.     dustthing = CreateThing(dust, rumblecamlook);
  254.     AnimateSpriteSize(dustthing, '0.2 0.2 0.5', '0.6 0.6 0.0', 4.0);
  255.     sleep(.3);
  256.     dustthing = CreateThing(dust, bombpos);
  257.     AnimateSpriteSize(dustthing, '0.2 0.2 0.5', '0.6 0.6 0.0', 4.0);
  258.     
  259.     # rest for a bit
  260.     Sleep(0.5);
  261.  
  262.     sleep(1);
  263.     PlaySoundThing(boom, goldidol, 1, -1, -1, 0);
  264.     sleep(.2);
  265.     PlaySoundThing(crunch, goldidol, 1, -1, -1, 0);
  266.     PlaySoundThing(crash, goldidol, 1, -1, -1, 0);
  267.  
  268.     # restore camera
  269.     SetCameraPosition(1, GetThingPos(rumblecam));
  270.     SetCurrentCamera(1);
  271.  
  272.     # more dust!
  273.     SetMaterialCel(dustmat, 0);
  274.     MaterialAnim(dustmat, 1.0, 1);
  275.     dustthing = CreateThing(dust, dustgen);
  276.     AnimateSpriteSize(dustthing, '0.2 0.2 0.5', '0.6 0.6 0.0', 4.0);
  277.     sleep(.3);
  278.     dustthing = CreateThing(dust, bombpos);
  279.     AnimateSpriteSize(dustthing, '0.2 0.2 0.5', '0.6 0.6 0.0', 4.0);
  280.  
  281.     # restore camera
  282.     SetCameraLookInterp(2, 0);
  283.     SetCameraPosInterp(2, 0);
  284.     SetCameraPosition(1, GetThingPos(rumblecam));
  285.     SetCurrentCamera(1);
  286.     DestroyThing(cam1spot);
  287.     DestroyThing(cam1look);
  288.     
  289.     # restore controls
  290.     EndCutscene();
  291.     ClearActorFlags(player, 0x200000);
  292.  
  293.     return;
  294.  
  295. pulse:
  296.     if (quivercam)
  297.     {
  298.         SetPOVShake('0.0 0.0 0.001', '0.0 0.0 0.0', 80.0, 0.8);
  299.         return;
  300.     }
  301.  
  302.     if (counter < 10)
  303.     {
  304.         counter = counter + 1;
  305.         shakefactor = shakefactor - .4;
  306.  
  307.         SetPOVShake(VectorScale(VectorSet(RandBetween(-1, 1), RandBetween(-1, 1), RandBetween(-1, 1)), .0005 * shakefactor),
  308.                     VectorScale(VectorSet(RandBetween(-6, 6), RandBetween(-4, 4), RandBetween(-2, 2)), .05 * shakefactor),
  309.                     10, 180);
  310.     }
  311.  
  312.     if (counter == 10) shakefactor = 10;
  313.     
  314.     if ((counter >= 10) && (counter < 35))
  315.     {
  316.         counter = counter + 1;
  317.         shakefactor = shakefactor - .3;
  318.  
  319.         SetPOVShake(VectorScale(VectorSet(RandBetween(-1, 1), RandBetween(-1, 1), RandBetween(-1, 1)), .0005 * shakefactor),
  320.                     VectorScale(VectorSet(RandBetween(-6, 6), RandBetween(-4, 4), RandBetween(-2, 2)), .05 * shakefactor),
  321.                     10, 180);
  322.     }
  323.     
  324.     if (counter == 35)
  325.     {
  326.         SetPulse(0);
  327.         counter=0;
  328.     }
  329.  
  330.     return;
  331.  
  332. end
  333.  
  334.  
  335.  
  336.  
  337.